#ifndef VIDEO_PLAYER_H_
#define VIDEO_PLAYER_H_


#define NOMINMAX
#include <windows.h>											// Header File For Windows
#include <vfw.h>												// Header File For Video For Windows
#include <string>
#include <locale>

#include <QtOpenGL/QtOpenGL>

#pragma comment( lib, "vfw32.lib" )								// Search For VFW32.lib While Linking

class VideoPlayer
{
public:
	VideoPlayer(std::string _videoName);
	~VideoPlayer();


	// member for video
	void flipIt(void* buffer);
	void OpenAVI(LPCWSTR szFile);
	void GrabAVIFrame(int frame);									// Grabs A Frame From The Stream
	void CloseAVI(void);												// Properly Closes The Avi File
	bool Initialize ();					// Any GL Init Code & User Initialiazation Goes Here
	void Deinitialize (void);										// Any User DeInitialization Goes Here
	void Update (DWORD milliseconds);								// Perform Motion Updates Here
	void Render (void);												// Draw Our Scene



private:
	LPCWSTR mVideoName;


	GLuint           mVideoImageID;

	// User Defined Variables
	int			mVideoNext;												// Used For Animation
	int			mVideoFrame;											// Frame Counter

	AVISTREAMINFO		mVideoPsi;										// Pointer To A Structure Containing Stream Info
	PAVISTREAM			mVideoPavi;										// Handle To An Open Stream
	PGETFRAME			mVideoPgf;										// Pointer To A GetFrame Object
	BITMAPINFOHEADER	mVideoBmih;										// Header Information For DrawDibDraw Decoding
	long				mVideoLastframe;									// Last Frame Of The Stream
	int					mVideoWidth;										// Video Width
	int					mVideoHeight;										// Video Height
	char				*mVideoPdata;										// Pointer To Texture Data
	int					mVideoMpf;										// Will Hold Rough Milliseconds Per Frame


	HDRAWDIB mVideoHdd;													// Handle For Our Dib
	HBITMAP mVideoHBitmap;												// Handle To A Device Dependant Bitmap
	HDC mVideoHdc;								// Creates A Compatible Device Context
	unsigned char* mVideoData;										// Pointer To Our Resized Image
	std::wstring mWStrVideoName;
};

#endif // VIDEO_PLAYER_H_